package com.cs.entity;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;

@Entity
@Table(name="teacher")
public class Teacher {
	private Integer id;
	private String tno;//教工号
	private String tname;//教师姓名
	private String tsex;//性别
	private String teb;//学历
	private String tpt;//职称
	private String tpassword;//密码
	private List<Course> course;//课程
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	@Column(name="tno")
	public String getTno() {
		return tno;
	}
	public void setTno(String tno) {
		this.tno = tno;
	}
	@Column(name="tname")
	public String getTname() {
		return tname;
	}
	public void setTname(String tname) {
		this.tname = tname;
	}
	@Column(name="tsex")
	public String getTsex() {
		return tsex;
	}
	public void setTsex(String tsex) {
		this.tsex = tsex;
	}
	@Column(name="teb")
	public String getTeb() {
		return teb;
	}
	public void setTeb(String teb) {
		this.teb = teb;
	}
	@Column(name="tpt")
	public String getTpt() {
		return tpt;
	}
	public void setTpt(String tpt) {
		this.tpt = tpt;
	}
	@Column(name="tpassword")
	public String getTpassword() {
		return tpassword;
	}
	public void setTpassword(String tpassword) {
		this.tpassword = tpassword;
	}
	@OneToMany(targetEntity=Course.class,mappedBy="teacher",cascade=CascadeType.ALL)
	public List<Course> getCourse() {
		return course;
	}
	public void setCourse(List<Course> course) {
		this.course = course;
	}
	@Override
	public String toString() {
		return "Teacher [id=" + id + ", tno=" + tno + ", tname=" + tname + ", tsex=" + tsex + ", teb=" + teb + ", tpt="
				+ tpt + ", tpassword=" + tpassword + ", course=" + course + "]";
	}
	
}
